<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>

    <!--    &lt;!&ndash;""代表跳转到当前页面  起到了刷新页面的作用&ndash;&gt;-->
    <!--    <a href="">超链接1</a>-->
    <!--    &lt;!&ndash;如果不写href属性就不是超链接&ndash;&gt;-->
    <!--    <a>超链接2</a>-->
    <!--    &lt;!&ndash;代表跳转到当前页面的顶部&ndash;&gt;-->
    <!--    <a href="">超链接3</a>-->
    <!--    &lt;!&ndash;不做任何操作&ndash;&gt;-->
    <!--    <a href="javascript:void (0)">超链接4</a>-->
    <div v-show="!isLogin"><!--isLogin=false-->
        <!--不做任何操作-->
        <a href="javascript:void (0)">注册</a>
        <a href="javascript:void (0)" @click="login()">登录</a>
    </div>
    <div v-show="isLogin">
        <a href="javascript:void (0)"@click="logout()">退出</a>
        <input type="text" v-model="newName">
        <a href="javascript:void (0)" @click="add()">添加</a>
    </div>


    <ul>
        <li v-for="name in arr">{{name}}</li>
    </ul>


    <hr>
</div>
<script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/vue/2.6.14/vue.js"></script>
<script>
    let v = new Vue({
        el:"div",
        data:{
            isLogin:false,
            arr:["悟空","八戒"],
            newName:""
        },
        methods:{
            login:function (){
                v.isLogin = true;
            },
            logout:function (){
                v.isLogin = false;
            },
            add:function (){
                v.arr().push(v.newName);
            }
        }
    });
</script>
</body>
</html>



















